package com.jimmy.medical.enums;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * @Desc: 工单类型

 * @author jimmy

 * @date 2018-05-12
 */
public enum FlowOrderTypeEnum {
	SIGN(1, "挂号"),
	TAKE(2, "取号"),
	DIAGNOSE(3, "陪诊"),
	CHECK(4, "开检查"),
	PHYSICAL_CHECK_SIGN(5, "备单"),
	PHYSICAL_CHECK(6, "陪检"),
	CHECK_REPORT(7, "取检查报告"),
	PHYSICAL_CHECK_REPORT(8, "取体检报告"),
	CANCEL_ORDER(9, "退号"),
	RESIGN_ORDER(10, "改号");

	private int key;	//代码
	private String text;	//名称

	FlowOrderTypeEnum(int key, String text) {
		this.key = key;
		this.text = text;
	}

	/**
	 * 根据key获取名称
	 */
	public static String getTextByKey(int key) {
		for (FlowOrderTypeEnum obj : FlowOrderTypeEnum.values()) {
			if (obj.key == key) {
				return obj.text;
			}
		}
		return null;
	}
	
	/**
	 * 将枚举类型转换为Map
	 * @return
	 */
	public static Map<Integer, String> getMapValue() {
		Map<Integer, String> map = new LinkedHashMap<Integer, String>();
		for (FlowOrderTypeEnum obj : FlowOrderTypeEnum.values()) {
			map.put(obj.key, obj.text);
		}
		return map;
	}
	
	public static List<Object> getKeyList() {
		List<Object> keyList = new ArrayList<Object>(){};
		keyList.add(SIGN.getKey()+"");
		keyList.add(TAKE.getKey()+"");
		keyList.add(DIAGNOSE.getKey()+"");
		keyList.add(CHECK.getKey()+"");
		keyList.add(PHYSICAL_CHECK_SIGN.getKey()+"");
		keyList.add(PHYSICAL_CHECK.getKey()+"");
		keyList.add(CHECK_REPORT.getKey()+"");
		keyList.add(PHYSICAL_CHECK_REPORT.getKey()+"");
		keyList.add(CANCEL_ORDER.getKey()+"");
		keyList.add(RESIGN_ORDER.getKey()+"");

		return keyList;
	}
	
	public int getKey() {
		return key;
	}

	public String getText() {
		return text;
	}
}
